﻿using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using Microsoft.Exchange.WebServices.Data;

namespace Entity
{

    public class ConnectionCache//邮件连接缓存
    {
        static Hashtable connections = new Hashtable();


        public static Hashtable Connections
        {
            get
            {
                return connections;
            }
        }
    }

    public enum MailFolderType//邮件所在文件夹
    {
        MsgRoot = 0,
        Inbox = 1,
        Other = 2
    }

    public enum DeleteModes//删除模式
    {
        HardDelete = 0,
        SoftDelete = 1,
        MoveToDeletedItems = 2
    }

    public class MailFolder//邮件文件夹对象(EWS)
    {
        string _displayName;

        public string DisplayName
        {
            get { return _displayName; }
            set { _displayName = value; }
        }

        string _folderID;

        public string FolderID
        {
            get { return _folderID; }
            set { _folderID = value; }
        }

        int _childFolderCount;

        public int ChildFolderCount
        {
            get { return _childFolderCount; }
            set { _childFolderCount = value; }
        }

        string _parentFolderID;

        public string ParentFolderID
        {
            get { return _parentFolderID; }
            set { _parentFolderID = value; }
        }
    }

    public class AttachmentFiles//附件文件对象
    {
        string _ID;

        public string ID
        {
            get { return _ID; }
            set { _ID = value; }
        }

        string _name;

        public string Name
        {
            get { return _name; }
            set { _name = value; }
        }

        string _fileName;

        public string FileName
        {
            get { return _fileName; }
            set { _fileName = value; }
        }

        string _transferEncoding;

        public string TransferEncoding
        {
            get { return _transferEncoding; }
            set { _transferEncoding = value; }
        }

        string _fileCodes;

        public string FileCodes
        {
            get { return _fileCodes; }
            set { _fileCodes = value; }
        }
    }

    public class InlineFiles//内嵌文件对象
    {
        string _fileName;

        public string FileName
        {
            get { return _fileName; }
            set { _fileName = value; }
        }

        string _contentID;

        public string ContentID
        {
            get { return _contentID; }
            set { _contentID = value; }
        }

        string _transferEncoding;

        public string TransferEncoding
        {
            get { return _transferEncoding; }
            set { _transferEncoding = value; }
        }
        string _fileCodes;

        public string FileCodes
        {
            get { return _fileCodes; }
            set { _fileCodes = value; }
        }
    }

    public class Mail//邮件对象
    {
        int _mailID;

        public int MailID
        {
            get { return _mailID; }
            set { _mailID = value; }
        }

        string _mailUID;

        public string MailUID
        {
            get { return _mailUID; }
            set { _mailUID = value; }
        }

        int _itemID;

        public int ItemID
        {
            get { return _itemID; }
            set { _itemID = value; }
        }

        DateTime _recivedDateTime;

        public DateTime RecivedDateTime
        {
            get { return _recivedDateTime; }
            set { _recivedDateTime = value; }
        }

        string _fromAddress;

        public string FromAddress
        {
            get { return _fromAddress; }
            set { _fromAddress = value; }
        }

        string _fromName;

        public string FromName
        {
            get { return _fromName; }
            set { _fromName = value; }
        }

        List<ContactNameCard> _to = new List<ContactNameCard>();

        public List<ContactNameCard> To
        {
            get { return _to; }
            set { _to = value; }
        }

        List<ContactNameCard> _cc = new List<ContactNameCard>();

        public List<ContactNameCard> Cc
        {
            get { return _cc; }
            set { _cc = value; }
        }

        List<ContactNameCard> _bcc = new List<ContactNameCard>();

        public List<ContactNameCard> Bcc
        {
            get { return _bcc; }
            set { _bcc = value; }
        }

        string _subject;

        public string Subject
        {
            get { return _subject; }
            set { _subject = value; }
        }

        string _tags;

        public string Tags
        {
            get { return _tags; }
            set { _tags = value; }
        }

        string _txtcontent;

        public string TextContent
        {
            get { return _txtcontent; }
            set { _txtcontent = value; }
        }

        string _htmlcontent;

        public string HTMLContent
        {
            get { return _htmlcontent; }
            set { _htmlcontent = value; }
        }

        List<AttachmentFiles> _attachmentFileList = new List<AttachmentFiles>();

        public List<AttachmentFiles> AttachmentFileList
        {
            get { return _attachmentFileList; }
            set { _attachmentFileList = value; }
        }

        List<InlineFiles> _inlineFileList = new List<InlineFiles>();

        public List<InlineFiles> InlineFileList
        {
            get { return _inlineFileList; }
            set { _inlineFileList = value; }
        }

        bool _isRead;

        public bool IsRead
        {
            get { return _isRead; }
            set { _isRead = value; }
        }

        private bool _isStar;

        public bool IsStar
        {
            get { return _isStar; }
            set { _isStar = value; }
        }
    }

    public class MailList//EWS邮件列表
    {
        List<Mail> _mailItems = new List<Mail>();

        public List<Mail> MailItems
        {
            get { return _mailItems; }
            set { _mailItems = value; }
        }

        bool _moreAvailable;

        public bool MoreAvailable
        {
            get { return _moreAvailable; }
            set { _moreAvailable = value; }
        }

        int _nextPageOffset;

        public int NextPageOffset
        {
            get { return _nextPageOffset; }
            set { _nextPageOffset = value; }
        }

        int _totalCount;

        public int TotalCount
        {
            get { return _totalCount; }
            set { _totalCount = value; }
        }
    }
}
